/*
** dtsledapp.c
**
*/

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>

#define LED_ON 1
#define LED_OFF 0

int main(int argc, char *argv[])
{

    int fd;
    int ret;

    printf("run!\n");

    fd = open("/dev/gpioled", O_RDWR);
    if (fd == -1)
    {
        printf("open %s failed.\n", "/dev/gpioled");
        return -1;
    }
    printf("open %s .\n", "/dev/gpioled");

    write(fd, "0", 1);
    sleep(1);
    write(fd, "1", 1);
    sleep(1);
    write(fd, "0", 1);
    sleep(1);
    write(fd, "1", 1);

    ret = close(fd);
    if (ret < 0)
    {
        printf("close %s failed.\n", "/dev/gpioled");
        return -1;
    }
    printf("close %s .\n", "/dev/gpioled");

    return 0;
}